<?php
class hrd_detail_pendidikan_model extends MY_Model {
	var $nama_tabel = 'hrd_detail_pendidikan';
	
	function GetJSON($idKaryawan) {
		$ls_sql	= "	SELECT	a.*
				FROM	".$this->nama_tabel." a
				WHERE 	id_karyawan_fk = '".$idKaryawan."'
				ORDER BY tahun_mulai";

		// return json_encode( $this->paging($ls_sql) );
		$list = $this->db->query($ls_sql)->result_array();
		$data = array('total' => count($list), 'rows' => $list);
		return json_encode($data);
	}

	function Add($arr_data){
		$this->db->insert($this->nama_tabel, $arr_data);
	}

	function Update($arr_data, $arr_rule){
		$this->db->update($this->nama_tabel, $arr_data, $arr_rule);
	}

	function DeleteSingle($arr_rule) {
		try {
			$this->db->delete($this->nama_tabel, array('id_detail_pendidikan_pk' => $arr_rule['id_detail_pendidikan_pk']));
			return '';
		} catch(Exception $e) {
			return $e->getMessage();
		}
	}

}
?>